/* Turska UI library
 * Copyright 2003-2008 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: UICheckBox.h,v 1.2 2008/03/27 11:44:22 tonic Exp $
 * $Revision: 1.2 $
 */

#ifndef UICHECKBOX_H_INCLUDED
#define UICHECKBOX_H_INCLUDED


class UICheckBox : public UIButton
{
public:

    //! Font anchor flags.
    /*! Defines the origin position for text alignment relative to the check box.
     *  The anchor field will be used only if textX is set to -1 in constructor.
     */
    enum ANCHOR_POSITION
    {
        ANCHOR_LEFT = 0,
        ANCHOR_MIDDLE,
        ANCHOR_RIGHT
    };

    UICheckBox(INT x, INT y, UIImage *defaultImage = NULL, UIImage *pressedImage = NULL,
               UIImage *checkImage = NULL, UIFont *font = NULL, const char *text = NULL,
               BOOL checkedState = FALSE, UINT textAnchor = ANCHOR_RIGHT,
               UINT32 fontFlags = UIFont::ALIGN_VERT_CENTER,
               INT textX = -1, INT textY = -1);
    virtual ~UICheckBox() {}

    virtual bool isInside(INT x, INT y);

    void setCheckImage(UIImage *image) { setSymbolImage(image); }
    UIImage * getCheckImage() { return getSymbolImage(); }

    void setChecked(bool checkedState) { mIsChecked = checkedState; }
    bool isChecked() { return mIsChecked; }

    virtual void onPointerUp(INT x, INT y);

    virtual void draw();

private:

    BOOL mIsChecked;
    UINT mAnchor;
    INT mCheckX, mCheckY;
    INT32 mStringWidth;
};


#endif // !UICHECKBOX_H_INCLUDED
